class Solution {
public:
    vector<int> searchRange(vector<int>& nums, int target) {
        vector<int> res={-1,-1};
        if(binary_search(nums.begin(),nums.end(),target)){
            auto x1=lower_bound(nums.begin(),nums.end(),target);
            auto x2=upper_bound(nums.begin(),nums.end(),target);
            res[0]=distance(nums.begin(),x1);
            res[1]=distance(nums.begin(),x2)-1;
        }
        return res;
    }
};
